<template>
  <view></view>
</template>

<script setup>
  import { onLoad } from '@dcloudio/uni-app';
  import healthCard from '../static/ElectronicHealthCard';
  import healthCardUtil from '@/utils/healthCard/index';

  onLoad(options => {
    init(options);
  });

  async function init(options) {
    console.log('redirectUrl【options】', options);
    const { registerOrderId } = options;
    if (registerOrderId) {
      // 直接验证
      uni.setNavigationBarTitle({ title: '授权验证中' });
      healthCardUtil.showLoad('授权验证中');
      const isVerify = await healthCard.checkVerify({
        registerOrderId,
        verifyOrderId: healthCardUtil.verifyOrderId,
      });
      if (isVerify) {
        healthCardUtil.verifySuccess();
      } else {
        healthCardUtil.verifyFail();
      }
    }
  }
</script>
